Manages the textures available in the component. More...
Public Member Functions | |
| ~TextureManager () | |
| Texture * | createOrRetrieve (const std::string_view &name) |
| Texture * | get (const std::string_view &name) |
| Texture * | getByIndex (unsigned int id) |
| void | rename (const std::string_view ¤tName, const std::string_view &newName) |
| void | erase (const std::string_view &name) |
| void | setActiveRenderTarget (Texture *target) |
| void | setActiveDepthTarget (Texture *target) |
| Texture * | getActiveRenderTarget () const |
| Texture * | getDepthTarget () const |
Manages the textures available in the component.
At all times, manager owns any memory allocated inside. External code should never delete memory returned by it.
| nkGraphics::TextureManager::~TextureManager | ( | ) |
Destructor.
| Texture* nkGraphics::TextureManager::createOrRetrieve | ( | const std::string_view & | name | ) |
Creates if unavailable, or retrieves if available, a texture.
| name | The name of the texture to retrieve. |
| Texture* nkGraphics::TextureManager::get | ( | const std::string_view & | name | ) |
Retrieves a texture.
| name | The name of the texture to retrieve. |
| Texture* nkGraphics::TextureManager::getByIndex | ( | unsigned int | id | ) |
Get a texture, by index. Note that one index can map to a different texture after memory is changed. Useful to loop over all available textures in one go.
| id | The index of the texture to retrieve. |
| void nkGraphics::TextureManager::rename | ( | const std::string_view & | currentName, |
| const std::string_view & | newName | ||
| ) |
Renames a texture.
| currentName | The name of the texture to rename. |
| newName | The name to reassign to the texture. |
| void nkGraphics::TextureManager::erase | ( | const std::string_view & | name | ) |
Erases and frees a texture.
| name | The name of the texture to erase. |
| void nkGraphics::TextureManager::setActiveRenderTarget | ( | Texture * | target | ) |
Sets the active render target. Used during rendering to feed data to the shaders, for instance.
| target | The target to flag as active. |
| void nkGraphics::TextureManager::setActiveDepthTarget | ( | Texture * | target | ) |
Sets the active depth render target. Used during rendering to feed data to the shaders, for instance.
| target | The target to flag as active. |
| Texture* nkGraphics::TextureManager::getActiveRenderTarget | ( | ) | const |
| Texture* nkGraphics::TextureManager::getDepthTarget | ( | ) | const |